package org.example.printexercise;

import android.util.Log;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import androidx.cardview.widget.CardView;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // 设置护眼黄色背景
        getWindow().getDecorView().setBackgroundColor(0xFFFFFF99);

        // 获取CardView引用
        CardView practiceCard = findViewById(R.id.practiceCard);
        CardView delayCard = findViewById(R.id.delayCard);
        CardView wechatCard = findViewById(R.id.wechatCard);
        CardView importCard = findViewById(R.id.importCard);
        CardView errorProneCard = findViewById(R.id.errorProneCard); // 新增

        // 开始练习模式（实时检查）
        practiceCard.setOnClickListener(v -> {
            Log.d("MainActivity", "Practice card clicked");
            Intent intent = new Intent(MainActivity.this, PracticeActivity.class);
            startActivity(intent);
        });

        // 延迟检查模式
        delayCard.setOnClickListener(v -> {
            Intent intent = new Intent(MainActivity.this, PracticeActivityDelay.class);
            startActivity(intent);
        });

        // 微信模式
        wechatCard.setOnClickListener(v -> {
            Intent intent = new Intent(MainActivity.this, WeChatPracticeActivity.class);
            startActivity(intent);
        });

        // 导入文章
        importCard.setOnClickListener(v -> {
            Intent intent = new Intent(MainActivity.this, ImportArticleActivity.class);
            startActivity(intent);
        });

        // 易错字练习模式（新增）
        errorProneCard.setOnClickListener(v -> {
            Intent intent = new Intent(MainActivity.this, PracticeActivityErrorProne.class);
            startActivity(intent);
        });
    }
}
